Properly compare multiple package versions#380
Conversation
|
Devil's advocate; do we always want it to install latest? |
Hmm.. You mean with alpha / beta versions? That's a good one. But if you don't want that, you can always specify the full signature (redactor-2.4.0-pl). And to clarify: this is only for packages that offer multiple versions under the same name. In my experience, ModMore is the only package provider doing that. And you even have a setting for pre-releases in your account settings ;) |
|
Indeed, bit of a shame it's not better supported. It's nice to give the choice ;) |
|
I've been testing this out this afternoon, and no issues found, nice work @hugopeek I do agree with @Mark-H that it would be great to offer a choice for when multiple versions are offered by the modmore provider. e.g.: Though I think perhaps that could be built into the interactive mode. Currently specifying I'll merge this now, and look at adding this choice in the near future. |
What does it do ?
Fix a silly mistake.
Why is it needed ?
I assumed that the max() function was able to figure out the highest semantic version number, but of course it's not that easy. Gitify selected 1.9.0 instead of 1.11.1 in my latest test, so apparently 1.9 was seen as higher than 1.1.
So the whole semantic version string needs to be picked apart and compared. Fortunately there's a version_compare function available in PHP that does just that, so it's now able to sniff out the actual latest version from the packageVersions array. Regardless of position. It even evaluates -alpha and -beta suffixes, so those should be correctly evaluated now too! They did for me with a test array.
Related issue(s)/PR(s)
#327